package cycles.util.jdbc;

import java.sql.ResultSet;
import java.sql.SQLException;

import cycles.util.jdbc.orm.DBField;
import cycles.util.jdbc.orm.DBTable;
import cycles.util.jdbc.orm.FieldMapType;

@DBTable("sample_table")
public class SampleBean implements IOrmInitor{

	int id;// same as db table

	@DBField(value = FieldMapType.SPECIFIED, dbfield = "name")
	String nick;// mapped the field "name" of table

	@DBField(value = FieldMapType.NOT_IN_MAP)
	String spec = "this field is not mapped in table";

	@DBField(value = FieldMapType.SPECIFIED, dbfield = "ints", parser = "String2Intlist")
	int[] intlist;// this class need a additional parser

	@Override
	public void init(ResultSet rs) throws SQLException {
		for(int v:intlist){
			v++;
			System.out.println(v);
		}
	}
}
